package context;

import state.Zh0202Grade;
import state.Zh0202Primary;

/**
 * @author: zh
 * @date: 2021/12/16 20:46
 * @version: 1.0
 */
public class Zh0202GamePlayer {
    private Zh0202Grade grade;

    public Zh0202Grade getGrade() {
        return grade;
    }

    public void setGrade(Zh0202Grade grade) {
        this.grade = grade;
    }
    public Zh0202GamePlayer() {
        this.grade = new Zh0202Primary(this);
    }

    public void winGame(){
        System.out.println("恭喜获得一局比赛的胜利");
        if (grade.doubleScore()){
            grade.setScore(grade.getScore()+40);
        }else {
            grade.setScore(grade.getScore()+20);
        }
        grade.checkGrade();
    }

    public void loseGame(){
        System.out.println("很遗憾你输掉了一场比赛");
        grade.setScore(grade.getScore()-15);
        grade.checkGrade();
    }
}
